package com.bamboo.model.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;

/**
* @description 存储桶枚举
* 存储桶名称格式为：{bucketName}-{appId}
* @date 2025/3/27 上午11:34
* @author chenzh
*/
public enum COSBucketEnum {
    BAMBOO(
            "bamboo","bamboo-1257113611", "ap-shanghai",
            "rs.weridwoman.top", "bamboo-1257113611.cos.ap-shanghai.myqcloud.com"
    ),
    TIGER(
            "tiger", "tigermall-1257113611", "ap-shanghai",
            "rs.weridwoman.top", "tigermall-1257113611.cos.ap-shanghai.myqcloud.com"
    );
    @EnumValue
    private final String code;
    private final String bucketName;
    private final String region;
    private final String customDomain;
    private final String cosDomain;
    COSBucketEnum(String code, String bucketName, String region, String customDomain, String cosDomain) {
        this.code = code;
        this.bucketName = bucketName;
        this.region = region;
        this.customDomain = customDomain;
        this.cosDomain = cosDomain;
    }

    public String getCode() {
        return code;
    }

    public String getBucketName() {
        return bucketName;
    }
    public String getRegion() {
        return region;
    }

    public String getCustomDomain() {
        return customDomain;
    }

    public String getCosDomain() {
        return cosDomain;
    }

    /**
     * @description 从存储桶名称中获取appId
     * 存储桶名称格式为：{bucketName}-{appId}
     * @date 2025/3/27 上午11:55
     * @author chenzh
     * @return String
     */
    public String getAppId() {
        return this.bucketName.substring(this.bucketName.lastIndexOf("-") + 1);
    }
}
